package com.ghck.shop.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.ghck.shop.model.GoodCollect;

public interface GoodCollectMapper {

	@Insert("insert into t_good_collect(good_id,user_id,create_time,update_time)values(#{goodId},#{userId},now(),now())")
	public Integer addGoodCollect(GoodCollect goodCollect);
	
	@Select("select * from t_good_collect where user_id=#{userId} order by update_time desc limit #{start},#{limit}")
	public List<GoodCollect> myGoodCollects(@Param("userId")Integer userId,@Param("start")Integer start,@Param("limit")Integer limit);
	
	@Delete("delete from t_good_collect where id=#{id}")
	public void deleteGoodCollect(Integer id);
	
	@Select("select * from t_good_collect where id=#{id}")
	public GoodCollect findGoodCollectById(Integer id);
	
	@Select("select * from t_good_collect where user_id=#{userId} and good_id=#{goodId}")
	public GoodCollect findGoodCollectByUserIdAndGoodId(@Param("userId")Integer userId,@Param("goodId")Integer goodId);
}
